package chapter03

import org.apache.spark.{SparkConf, SparkContext}

object Test03_RDD {
  def main(args: Array[String]): Unit = {
    //创建RDD
    val conf = new SparkConf().setMaster("local[*]").setAppName("RDD")
    val sc = new SparkContext(conf)
    //直接创建 两个函数一致
    val value = sc.makeRDD(List(1, 2, 3, 4, 5))
    val value2 = sc.makeRDD(Array(1, 2, 3, 4, 5))
    val value1 = sc.parallelize(List(1, 2, 3, 4))
    val value3 = sc.makeRDD(List((1, "张三"), (2, "李四")))
    println(value.collect().toList)
    //通过文件创建
    val value4 = sc.textFile("input/word.txt")
    println(value4.collect().mkString("Array(", ", ", ")"))
  }
}
